//
//  NearUser.m
//  SportSocial
//
//  Created by yull on 14/12/28.
//  Copyright (c) 2014年 yull. All rights reserved.
//

#import "NearUser.h"

@implementation NearUser

+ (instancetype)userWithDict:(NSDictionary *)dict
{
    NearUser *nearUser = [[NearUser alloc] init];
    
    for (NSString *key in dict.allKeys) {
        id value = [dict objectForKey:key];
        if ([value isKindOfClass:[NSNull class]]) {
            value = @"";
        }
        
        [nearUser setValue:value forKey:key];
    }
        
    return nearUser;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"userIcon"]) {
        [self setValue:value forKey:@"icon"];
    }else if ([key isEqualToString:@"userName"]) {
        [self setValue:value forKey:@"name"];
    }else {
        [super setValue:value forUndefinedKey:key];
    }
}
@end
